#include<bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
const int G = 3,GINV = (MOD + 1)/3;
int qpow(int x,int p){
    int res = 1;
    while (p){
        if(p & 1){
            res = 1ll*res*x%MOD;
        }
        x = 1ll*x*x%MOD;
        p >>= 1;
    }
    return res;
}
vector<int> trs[23];
vector<int> bg[23];
vector<int> bginv[23];
void init(){
    for(int i = 1;i<=20;i++){
        trs[i] = vector<int>(1<<i);
        bg[i] = vector<int>(1<<i - 1);
        bginv[i] = vector<int>(1<<i - 1); 
        for(int j = 0;j < i;j++){
            for(int k = 1<<j;k < (1<<j + 1);k++){
                trs[i][k] = trs[i][k - (1<<j)] | (1<<(i - j - 1));
            }
        }
        bg[i][0] = 1;
        bginv[i][0] = 1;
        int o1 = qpow(G,(MOD - 1)/(1<<i));
        int o2 = qpow(GINV,(MOD - 1)/(1<<i));
        bg[i][0] = 1;
        bginv[i][0] = 1;
        for(int j = 1;j < (1<<i - 1);j++){
            bg[i][j] = 1ll*bg[i][j - 1]*o1%MOD;
            bginv[i][j] = 1ll*bginv[i][j - 1]*o2%MOD;
        }
    }
}
vector<int> FFT(const vector<int> &val,int tot,int lgt,vector<int> *base = bg){
    vector<int> res(tot);
    for(int j = 0;j < tot;j++){
        if(trs[lgt][j] < val.size()){
            res[j] = val[trs[lgt][j]];
        }
    }
    for(int i = 1;i <= lgt;i++){
        int len = 1<<i;
        int hlen = len/2;
        for(int j = 0;j < tot;j += len){
            for(int k = j;k < j + hlen;k ++ ){
                int va = res[k],vb = 1ll*res[k + hlen]*base[i][k - j]%MOD;
                res[k] = (va + vb)%MOD;
                res[k + hlen] = (va - vb + MOD)%MOD;
            }
        }
    }
    return res;
}
vector<int> IFFT(const vector<int> &val,int tot,int lgt){
    return FFT(val,tot,lgt,bginv);
}
vector<int> operator*(const vector<int> &va,const vector<int> &vb){
    int n = va.size() - 1;
    int m = vb.size() - 1;
    int tot = 1;
    int lgt = 0;
    while(tot <= n + m){
        tot*=2;
        lgt++;
    }
    vector<int> FA = FFT(va,tot,lgt),FB = FFT(vb,tot,lgt);
    for(int i = 0;i < tot;i++){
        FA[i] = 1ll*FA[i]*FB[i]%MOD;
    }
    FA = IFFT(FA,tot,lgt);
    FA.resize(n + m + 1);
    int inv = qpow(tot,MOD -2);
    for(int i = 0;i < FA.size();i++){
        FA[i] = 1ll*FA[i]*inv%MOD;
    }
    return FA;
}
vector<int> operator+(const vector<int> &va,const vector<int> &vb){
    vector<int> res(va);
    if(vb.size() > va.size()){
        res.resize(vb.size());
    }
    for(int i = 0;i < vb.size();i++){
        res[i] = (res[i] + vb[i])%MOD;
    }
    return res;
}
vector<int> operator-(const vector<int> &va,const vector<int> &vb){
    vector<int> res(va);
    if(vb.size() > va.size()){
        res.resize(vb.size());
    }
    for(int i = 0;i < vb.size();i++){
        res[i] = (res[i] - vb[i] + MOD)%MOD;
    }
    return res;
}
vector<int> rev(const vector<int> &va){
    vector<int> res(va);
    reverse(res.begin(),res.end());
    return res;
}
int n,m;
// tangwanle buyongqumo
const int N = 1e5+10;
int jc[N],a[N];
int jc_1[N];
int main(){
    init();
    cin>>n>>m;
    for(int i = 0;i<n;i++){
        cin>>a[i];    
    }
    n--;
    vector<int> A(n + 1),B(n + 1);
    jc[0] = 1;
    for(int i = 1;i <= n;i++){
        jc[i] = 1ll*jc[i - 1]*i%MOD;
    }
    jc_1[n] = qpow(jc[n],MOD - 2);
    for(int i = n - 1;i >= 1;i--){
        jc_1[i] = 1ll*jc_1[i + 1]*(i + 1)%MOD;
    }
    jc_1[0] = 1;
    for(int i = 0;i <= n;i++){
        A[i] = 1ll*jc[n - i]*a[n - i]%MOD;
    }
    int p = 1;
    for(int i = 0;i <= n;i++){
        B[i] = 1ll*jc_1[i]*p%MOD;
        p = 1ll*p*m%MOD;
    }
    vector<int> res = A*B;
    for(int i = 0;i <= n;i++){
        cout<<1ll*res[n - i]*jc_1[i]%MOD<<' ';
    }
    cout<<'\n';
    A = vector<int>(n + 1);
    B = vector<int>(n*2 + 1);
    for(int i = 0;i <= n;i++){
        if((n - i) % 2 == 0){
            A[i] = 1ll*a[i]*jc_1[i]%MOD*jc_1[n - i]%MOD;
        }else{
            A[i] = (MOD - 1ll*a[i]*jc_1[i]%MOD*jc_1[n - i]%MOD)%MOD;
        }
    }
    for(int i = 0;i<=n*2;i++){
        B[i] = qpow((i + m - n + MOD)%MOD,MOD - 2);
    }
    res = A*B;
    int pmu = 0;
    for(int j = 0;j <= n;j++){
        if((m + j)%MOD <= n){
            cout<<a[(m + j)%MOD]<<' ';
            pmu = 0;
        }else{
            if(!pmu){
                pmu = 1;
                for(int k = m + j;k >= m + j - n;k--){
                    pmu = 1ll*pmu*k%MOD;
                }
            }else{
                pmu = 1ll*pmu*(m + j)%MOD*qpow((m + j - n - 1 + MOD)%MOD,MOD - 2)%MOD;
            }
            cout<<1ll*res[n + j]*pmu%MOD<<' ';
        }
    }
    cout<<'\n';
}